<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
                      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
    <title>Consuming a Single Atom Entry - Zend Framework Manual</title>

    <link href="../css/shCore.css" rel="stylesheet" type="text/css" />
    <link href="../css/shThemeDefault.css" rel="stylesheet" type="text/css" />
    <link href="../css/styles.css" media="all" rel="stylesheet" type="text/css" />
</head>
<body>
<h1>Zend Framework</h1>
<h2>Programmer's Reference Guide</h2>
<ul>
    <li><a href="../en/zend.feed.consuming-atom-single-entry.html">Inglês (English)</a></li>
    <li><a href="../pt-br/zend.feed.consuming-atom-single-entry.html">Português Brasileiro (Brazilian Portuguese)</a></li>
</ul>
<table width="100%">
    <tr valign="top">
        <td width="85%">
            <table width="100%">
                <tr>
                    <td width="25%" style="text-align: left;">
                    <a href="zend.feed.consuming-atom.html">Consuming an Atom Feed</a>
                    </td>

                    <td width="50%" style="text-align: center;">
                        <div class="up"><span class="up"><a href="zend.feed.html">Zend_Feed</a></span><br />
                        <span class="home"><a href="manual.html">Guia de Refer&ecirc;ncia do Programador</a></span></div>
                    </td>

                    <td width="25%" style="text-align: right;">
                        <div class="next" style="text-align: right; float: right;"><a href="zend.feed.modifying-feed.html">Modifying Feed and Entry structures</a></div>
                    </td>
                </tr>
            </table>
<hr />
<div id="zend.feed.consuming-atom-single-entry" class="section"><div class="info"><h1 class="title">Consuming a Single Atom Entry</h1></div>
    

    <p class="para">
        Single Atom <strong class="command">&lt;entry&gt;</strong> elements are also valid by themselves. Usually
        the <acronym class="acronym">URL</acronym> for an entry is the feed&#039;s <acronym class="acronym">URL</acronym> followed by
        <strong class="command">/&lt;entryId&gt;</strong>, such as
        <var class="filename">http://atom.example.com/feed/1</var>, using the example
        <acronym class="acronym">URL</acronym> we used above.
    </p>

    <p class="para">
        If you read a single entry, you will still have a <span class="classname">Zend_Feed_Atom</span>
        object, but it will automatically create an &quot;anonymous&quot; feed to contain the entry.
    </p>

    <div class="example" id="zend.feed.consuming-atom-single-entry.example.atom"><div class="info"><p><b>Example #1 Reading a Single-Entry Atom Feed</b></p></div>
        

        <pre class="programlisting brush: php">
$feed = new Zend_Feed_Atom(&#039;http://atom.example.com/feed/1&#039;);
echo &#039;The feed has: &#039; . $feed-&gt;count() . &#039; entry.&#039;;

$entry = $feed-&gt;current();
</pre>

    </div>

    <p class="para">
        Alternatively, you could instantiate the entry object directly if you know you are accessing
        an <strong class="command">&lt;entry&gt;</strong>-only document:
    </p>

    <div class="example" id="zend.feed.consuming-atom-single-entry.example.entryatom"><div class="info"><p><b>Example #2 Using the Entry Object Directly for a Single-Entry Atom Feed</b></p></div>
        

        <pre class="programlisting brush: php">
$entry = new Zend_Feed_Entry_Atom(&#039;http://atom.example.com/feed/1&#039;);
echo $entry-&gt;title();
</pre>

    </div>
</div>
        <hr />

            <table width="100%">
                <tr>
                    <td width="25%" style="text-align: left;">
                    <a href="zend.feed.consuming-atom.html">Consuming an Atom Feed</a>
                    </td>

                    <td width="50%" style="text-align: center;">
                        <div class="up"><span class="up"><a href="zend.feed.html">Zend_Feed</a></span><br />
                        <span class="home"><a href="manual.html">Guia de Refer&ecirc;ncia do Programador</a></span></div>
                    </td>

                    <td width="25%" style="text-align: right;">
                        <div class="next" style="text-align: right; float: right;"><a href="zend.feed.modifying-feed.html">Modifying Feed and Entry structures</a></div>
                    </td>
                </tr>
            </table>
</td>
        <td style="font-size: smaller;" width="15%"> <style type="text/css">
#leftbar {
	float: left;
	width: 186px;
	padding: 5px;
	font-size: smaller;
}
ul.toc {
	margin: 0px 5px 5px 5px;
	padding: 0px;
}
ul.toc li {
	font-size: 85%;
	margin: 1px 0 1px 1px;
	padding: 1px 0 1px 11px;
	list-style-type: none;
	background-repeat: no-repeat;
	background-position: center left;
}
ul.toc li.header {
	font-size: 115%;
	padding: 5px 0px 5px 11px;
	border-bottom: 1px solid #cccccc;
	margin-bottom: 5px;
}
ul.toc li.active {
	font-weight: bold;
}
ul.toc li a {
	text-decoration: none;
}
ul.toc li a:hover {
	text-decoration: underline;
}
</style>
 <ul class="toc">
  <li class="header home"><a href="manual.html">Guia de Refer&ecirc;ncia do Programador</a></li>
  <li class="header up"><a href="manual.html">Guia de Refer&ecirc;ncia do Programador</a></li>
  <li class="header up"><a href="reference.html">Refer&ecirc;ncia do Zend Framework</a></li>
  <li class="header up"><a href="zend.feed.html">Zend_Feed</a></li>
  <li><a href="zend.feed.introduction.html">Introduction</a></li>
  <li><a href="zend.feed.importing.html">Importing Feeds</a></li>
  <li><a href="zend.feed.findFeeds.html">Retrieving Feeds from Web Pages</a></li>
  <li><a href="zend.feed.consuming-rss.html">Consuming an RSS Feed</a></li>
  <li><a href="zend.feed.consuming-atom.html">Consuming an Atom Feed</a></li>
  <li class="active"><a href="zend.feed.consuming-atom-single-entry.html">Consuming a Single Atom Entry</a></li>
  <li><a href="zend.feed.modifying-feed.html">Modifying Feed and Entry structures</a></li>
  <li><a href="zend.feed.custom-feed.html">Custom Feed and Entry Classes</a></li>
  <li><a href="zend.feed.reader.html">Zend_Feed_Reader</a></li>
  <li><a href="zend.feed.writer.html">Zend_Feed_Writer</a></li>
  <li><a href="zend.feed.pubsubhubbub.introduction.html">Zend_Feed_Pubsubhubbub</a></li>
 </ul>
 </td>
    </tr>
</table>

<script type="text/javascript" src="../js/shCore.js"></script>
<script type="text/javascript" src="../js/shAutoloader.js"></script>
<script type="text/javascript" src="../js/main.js"></script>

</body>
</html>